
/*
 * Copyright (C) Igor Sysoev
 * Copyright (C) Nginx, Inc.
 */


#ifndef _NGX_SHMEM_H_INCLUDED_
#define _NGX_SHMEM_H_INCLUDED_


#include <ngx_config.h>
#include <ngx_core.h>


typedef struct {
    u_char      *addr;  // 指向申请的共享内存块首地址
    size_t       size;  // 内存块大小
    ngx_str_t    name;  // 内存块名称
    ngx_log_t   *log;   // 记录日志
    ngx_uint_t   exists;   /* unsigned  exists:1;  */  // 标识是否已经存在
} ngx_shm_t;


// 创建共享内存块
ngx_int_t ngx_shm_alloc(ngx_shm_t *shm);

// 释放共享内存块
void ngx_shm_free(ngx_shm_t *shm);


#endif /* _NGX_SHMEM_H_INCLUDED_ */
